exports.hide_order = function(req,res) {

    //获取restful参数
    var bodyParams = req.routeInfo.bodyParams;
    var resultData = {};
    var orderid = 0;
    var o_type = 0;
    var o_activity_type = 0;
    var bj_id = 0;

    //任务流创建
    async.waterfall([

        function(cb){

            R.SEND_HTTP(
                req,
                {
                    url    : CORE_APIConfig.coreAPI.update_order,
                    method : 'POST',
                    data:{
                        o_no:bodyParams.o_no,
                        is_hide:1
                    }
                },
                function (err, data) {

                    resultData = true;

                    cb();
                }
            );

        },
        //在未支付的情况下删除订单，还可以被砍价  （更新 is_order 字段  和  bj_oid 字段）
        //查询订单id
        function(cb){

            R.SEND_HTTP(
                req,
                {
                    url    : CORE_APIConfig.coreAPI.search_order +"/o_no/"+ bodyParams.o_no,
                    method : 'POST',
                    data:{
                        fields: [
                            "o_id",
                            "o_type", //订单的类型 0-机构活动 1-论坛活动 2-课程\r\n
                            "o_activity_type",//如果为活动， 0-拼团 1-投票 2-砍价 3-H5海报 4-助力 5-促销活动 6-微传单
                        ].join(",")
                    }
                },
                function (err, data) {

                    orderid = data.data[0].o_id;
                    o_type = data.data[0].o_type;
                    o_activity_type = data.data[0].o_activity_type;
                    console.log("orderid"+orderid);
                    console.log("o_type"+o_type);
                    console.log("o_activity_type"+o_activity_type);
                    cb();
                }
            );

        },
        function(cb){
            if(o_type == 0 && o_activity_type == 2){
                R.SEND_HTTP(
                    req,
                    {
                        url    : CORE_APIConfig.coreAPI.searchBargainJoin+"/bj_is_complete/0/bj_oid/"+ orderid,
                        method : 'POST',
                        data:{
                            fields: [
                                "bj_id",
                            ].join(",")
                        }
                    },
                    function (err, data) {

                        bj_id = data.data;

                        cb();
                    }
                );
            }else{
                cb();
            }
        },
        function(cb){
            if(o_type == 0 && o_activity_type == 2 && bj_id.length>0){
                console.log(112323);
                R.SEND_HTTP(
                    req,
                    {
                        url    : CORE_APIConfig.coreAPI.updateBargainJoin,
                        method : 'POST',
                        data:{
                            "bj_id": bj_id[0].bj_id,
                            "bj_oid" : 0,
                            "bj_is_order" : 0
                        }
                    },
                    function (err, data) {

                        resultData = true;

                        cb();
                    }
                );
            }else{
                cb();
            }
        }
    ],function(err, result){

        //返回最终拼接结果
        RES.response(res,true,resultData);

    });
}